<template>
  <Row :gutter="gutter">
    <sh-form-col
      v-for="item in dataSource.list || []"
      :key="item.key"
      :dataSource="item"
      :dictData="dictData"
      @change="e => emits('change', e)"
    >
      <template #[item.slot]>
        <slot :name="item.slot" :item="item" />
      </template>
      <template #[item.itemSlot]>
        <slot :name="item.itemSlot" :item="item" />
      </template>
    </sh-form-col>
  </Row>
</template>
<script setup>
import ShFormCol from './sh-form-col.vue';

const props = defineProps({
  // 代表表单总入参项config里的小类data
  dataSource: {
    type: Object,
    default: () => {},
  },
  // 两个表单项之间的间距
  gutter: {
    type: Number,
  },
  // 字典项的汇总data
  dictData: {
    type: Object,
    default: () => {},
  },
});

const emits = defineEmits(['change']);
</script>
